<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <title>Title</title>
</head>
<body>
<div id="app">
    <div id="components-demo3">
        <button-counter2></button-counter2>
        <button-counter2></button-counter2>
        <button-counter2></button-counter2>
    </div>
</div>
</body>
<script>
    //创建对象
    var buttonCounter2Data = {
        count: 0
    }
    //自定义组件
    Vue.component('button-counter2', {

        data: function () {
            return buttonCounter2Data
        },
        template: '<button v-on:click="count++">点击了 {{ count }} 次。</button>'
    })
    new Vue({
        el: '#components-demo3'
    })

</script>
</html>